import java.util.Scanner;

public class demo09 {
    public static void main(String[] args) {
        Scanner sc = new Scanner( System.in );

        System.out.println("请输入一个数字");
        String st=sc.next();
        int sum=0;
        for (int i=0;i<st.length();i++){
            int a=Integer.parseInt(st.charAt(i)+"");
            sum+=a;
        }
        System.out.println("各位数字之和为"+sum);
    }
}
